" vim

" Better opening lines to remove accidental comments {{{1
autocmd FileType vim setlocal formatoptions-=c formatoptions-=r formatoptions-=o

" colorcolumn 100 {{{1
autocmd FileType vim setlocal colorcolumn=100

" Auto clear whitespace {{{1
autocmd BufWritePre *.vim ClearWhitespace
autocmd BufWritePre *vimrc* ClearWhitespace

" Quick vim script for new functions {{{1
autocmd BufNewFile,BufRead *.vim inoreabbrev func function! Function()<cr>endfunction<esc>O <esc>a
autocmd BufNewFile,BufRead *vimrc* inoreabbrev func function! Function()<cr>endfunction<esc>O <esc>a

" Quick vim script for new commands {{{1
autocmd BufNewFile,BufRead *.vim inoreabbrev comm command! silent! call Function()<esc>0Ea
autocmd BufNewFile,BufRead *vimrc* inoreabbrev comm command! silent! call Function()<esc>0Ea

" unmap end when leaving
autocmd BufLeave *.vim silent! iunabbrev func
autocmd BufLeave *vimrc* silent! iunabbrev func
autocmd BufLeave *.vim silent! iunabbrev comm
autocmd BufLeave *vimrc* silent! iunabbrev comm
